package it.managerService;


import it.Dao.BooksDao;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.sql.SQLException;

/**
 * @author wsx
 * @create 2020-04-20-15:00
 */
@WebServlet("/deleteUser")
public class deleteUser extends HttpServlet {
    @Override
    protected void service(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        req.setCharacterEncoding("UTF-8");
        String id = req.getParameter("id");
        BooksDao booksDao = new BooksDao();
        int update=0;
        try {
            update = booksDao.deleteUser(id);
        } catch (SQLException e) {
            e.printStackTrace();
        }
        req.getRequestDispatcher("userInfo").forward(req,resp);
    }
}
